package test.h0815;

import java.util.Scanner;

public class Main10 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String s = sc.nextLine();
        int maxLength=-1;
        for (int i = 0; i < s.length(); i++) {
            for (int j = i+1; j <= s.length(); j++) {
                String temp=s.substring(i,j);
                if (judge(temp)){
                    maxLength=Math.max(temp.length(),maxLength);
                }
            }
        }
        System.out.println(maxLength);
    }

    private static boolean judge(String temp) {
        char[] chars = temp.toCharArray();
        int countL=0;
        int countD=0;
        for (int i = 0; i < chars.length; i++) {
            if (Character.isLetter(chars[i])){
                countL++;
            }
            if (Character.isDigit(chars[i])){
                countD++;
            }
        }
        if (countD>0&&countL==1){
            return true;
        }
        return false;
    }
}
